package com.app.jzgdirector.common.view;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.app.jzgdirector.R;

/**
 * 作者: ZHANGDSH
 * 时间: 16/9/23
 * 邮箱: ZHANGDEYUAN581@PINGAN.COM.CN
 * 描述: 统一广告弹窗对话框
 */
public class AdvertDialog extends BaseDialog {

    public static final String TAG = "AdvertDialog";

    private TextView txtTitle;
    private TextView txtContent;
    private TextView txtDesc;

    private Button btnSure;

    private OnAdDialogListener mOnAdDialogListener = null;


    public AdvertDialog(Context context) {
        super(context, R.style.Advert_Dialog);
    }



    @Override
    public int getDialogLayout() {
        return R.layout.dialog_advert_layout;
    }

    public void init(Context context) {
        super.init(context);
        setCancelable(false);
        setCanceledOnTouchOutside(false);
        getWindow().setGravity(Gravity.CENTER);

        txtTitle = (TextView) findViewById(R.id.txt_title);
        txtContent = (TextView) findViewById(R.id.txt_content);
        txtDesc = (TextView) findViewById(R.id.txt_bottom);
        btnSure = (Button) findViewById(R.id.img_sure);

        btnSure.setOnClickListener((View view)-> {
                dismiss();
        });
    }

    /**
     * 设置点击事件
     */
    public void setOnDialogClickListener(OnAdDialogListener onAdDialogListener) {
        mOnAdDialogListener = onAdDialogListener;
    }

    public interface OnAdDialogListener {
        /**
         * 点击
         */
        void onDialogClickJump();

        /**
         * 检查是否可以显示
         */
        boolean checkCanShow();

        /**
         * 显示完后的回调
         */
        void onShowCallback();

        /**
         * 加载失败后的回调
         */
        void onFinishCallback();

        class Stub implements OnAdDialogListener {

            @Override
            public void onDialogClickJump() {

            }

            @Override
            public boolean checkCanShow() {
                return false;
            }

            @Override
            public void onShowCallback() {

            }

            @Override
            public void onFinishCallback() {

            }
        }
    }
}
